package com.boarsoft.boar.sequence.entity;

import java.io.Serializable;

public class SequenceInfo implements Serializable {
	protected static final long serialVersionUID = 2514492531759618382L;

	/** 分段式序号 */
	public static final short TYPE_SEGMENT = 0;
	/** 分片ID（节点ID） + 本地序号 或 全局有序序号 */
	public static final short TYPE_PATTERN = 1;

	public static final short STATUS_DISABLE = 0;
	public static final short STATUS_ENABLE = 1;

	/** 主键 */
	protected String id;
	/** 所属系统 */
	protected String catalog;
	/** 系统内编号 */
	protected String code;
	/** 中文名 */
	protected String name;
	/** 序列中序号部分的的初始值（相对或全局） */
	protected long beginNo = 0L;
	/** 大于此值就自动重置序号为begin，为0表示无红线（不自动重置） */
	protected long endNo = 0L;
	/** 分段大小，用于自动创建区段 */
	protected int segLen = 100000;
	/** 当前分段 */
	protected long lastNo;
	/** */
	protected short type = TYPE_SEGMENT;
	/** */
	protected short status = STATUS_DISABLE;
	/** */
	protected String memo;
	/** 多号段是否可循环使用 */
	protected boolean recyclable;

	public void update(SequenceInfo o) {
		this.beginNo = o.beginNo;
		this.catalog = o.catalog;
		this.code = o.code;
		this.name = o.name;
		this.memo = o.memo;
		this.endNo = o.endNo;
		this.segLen = o.segLen;
		this.type = o.type;
	}

	public String toString() {
		return id;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getCatalog() {
		return catalog;
	}

	public void setCatalog(String catalog) {
		this.catalog = catalog;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public long getBeginNo() {
		return beginNo;
	}

	public void setBeginNo(long begin) {
		this.beginNo = begin;
	}

	public long getEndNo() {
		return endNo;
	}

	public void setEndNo(long end) {
		this.endNo = end;
	}

	public int getSegLen() {
		return segLen;
	}

	public void setSegLen(int segLen) {
		this.segLen = segLen;
	}

	public short getType() {
		return type;
	}

	public void setType(short type) {
		this.type = type;
	}

	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	public long getLastNo() {
		return lastNo;
	}

	public void setLastNo(long lastNo) {
		this.lastNo = lastNo;
	}

	public short getStatus() {
		return status;
	}

	public void setStatus(short status) {
		this.status = status;
	}

	public boolean isRecyclable() {
		return recyclable;
	}

	public void setRecyclable(boolean recyclable) {
		this.recyclable = recyclable;
	}
}
